import request from '@/config/axios'

// 采购入库主 VO
export interface Rdrecord01VO {
  id: number // id
  code: string // 流水号
  cpersoncode: string // 业务员编码
  cdepcode: string // 部门编码
  cvencode: string // 供应商编码
  cwhcode: string // 仓库编码
  ddate: Date // 订单日期
  cmemo: string // 备注
}

// 采购入库主 API
export const Rdrecord01Api = {
  // 查询采购入库主分页
  getRdrecord01Page: async (params: any) => {
    return await request.get({ url: `/wms/rdrecord01/page`, params })
  },

  // 查询采购入库主详情
  getRdrecord01: async (id: String) => {
    return await request.get({ url: `/wms/rdrecord01/get?id=` + id })
  },

  // 新增采购入库主
  createRdrecord01: async (data: Rdrecord01VO) => {
    return await request.post({ url: `/wms/rdrecord01/create`, data })
  },

  // 修改采购入库主
  updateRdrecord01: async (data: Rdrecord01VO) => {
    return await request.put({ url: `/wms/rdrecord01/update`, data })
  },

  // 删除采购入库主
  deleteRdrecord01: async (id: number) => {
    return await request.delete({ url: `/wms/rdrecord01/delete?id=` + id })
  },

  // 导出采购入库主 Excel
  exportRdrecord01: async (params) => {
    return await request.download({ url: `/wms/rdrecord01/export-excel`, params })
  },

      //提交
      submit: async (id: number) => {
        return await request.get({ url: `/wms/rdrecord01/startProcess?id=` + id })
      },
  

// ==================== 子表（采购入库子） ====================

  // 获得采购入库子列表
  getRdrecords01ListByPid: async (pid) => {
    return await request.get({ url: `/wms/rdrecord01/rdrecords01/list-by-pid?pid=` + pid })
  },
}
